SMMX21: Research methods in social science VT25
create survey experiment
analyze experiment data
<!-- randomize experimental condition -->
<script>
if(Math.random() >= 0.5) {
//window.location.href = "http://host/versionA";
var cond = "a";
} else {
//window.location.href = "http://host/versionB";
var cond = "b";
}
// Dynamically construct the cond_url
var currentUrl = window.location.href;
var hostname = new URL(currentUrl).hostname;
// Assuming the first directory is at index 3
var firstDirectory = currentUrl.split("/")[3];
var cond_url = "https://" + hostname + "/" + firstDirectory + "/web/tjs/cond-" + cond + ".html";